# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContainerAnalysis.V1beta1.Model.Vulnerability do
  @moduledoc """
  Vulnerability provides metadata about a security vulnerability in a Note.

  ## Attributes

  *   `cvssScore` (*type:* `number()`, *default:* `nil`) - The CVSS score for this vulnerability.
  *   `cvssV2` (*type:* `GoogleApi.ContainerAnalysis.V1beta1.Model.CVSS.t`, *default:* `nil`) - The full description of the CVSS for version 2.
  *   `cvssV3` (*type:* `GoogleApi.ContainerAnalysis.V1beta1.Model.CVSSv3.t`, *default:* `nil`) - The full description of the CVSS for version 3.
  *   `cvssVersion` (*type:* `String.t`, *default:* `nil`) - CVSS version used to populate cvss_score and severity.
  *   `cwe` (*type:* `list(String.t)`, *default:* `nil`) - A list of CWE for this vulnerability. For details, see: https://cwe.mitre.org/index.html
  *   `details` (*type:* `list(GoogleApi.ContainerAnalysis.V1beta1.Model.Detail.t)`, *default:* `nil`) - All information about the package to specifically identify this vulnerability. One entry per (version range and cpe_uri) the package vulnerability has manifested in.
  *   `severity` (*type:* `String.t`, *default:* `nil`) - Note provider assigned impact of the vulnerability.
  *   `sourceUpdateTime` (*type:* `DateTime.t`, *default:* `nil`) - The time this information was last changed at the source. This is an upstream timestamp from the underlying information source - e.g. Ubuntu security tracker.
  *   `windowsDetails` (*type:* `list(GoogleApi.ContainerAnalysis.V1beta1.Model.WindowsDetail.t)`, *default:* `nil`) - Windows details get their own format because the information format and model don't match a normal detail. Specifically Windows updates are done as patches, thus Windows vulnerabilities really are a missing package, rather than a package being at an incorrect version.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cvssScore => number() | nil,
          :cvssV2 => GoogleApi.ContainerAnalysis.V1beta1.Model.CVSS.t() | nil,
          :cvssV3 => GoogleApi.ContainerAnalysis.V1beta1.Model.CVSSv3.t() | nil,
          :cvssVersion => String.t() | nil,
          :cwe => list(String.t()) | nil,
          :details => list(GoogleApi.ContainerAnalysis.V1beta1.Model.Detail.t()) | nil,
          :severity => String.t() | nil,
          :sourceUpdateTime => DateTime.t() | nil,
          :windowsDetails =>
            list(GoogleApi.ContainerAnalysis.V1beta1.Model.WindowsDetail.t()) | nil
        }

  field(:cvssScore)
  field(:cvssV2, as: GoogleApi.ContainerAnalysis.V1beta1.Model.CVSS)
  field(:cvssV3, as: GoogleApi.ContainerAnalysis.V1beta1.Model.CVSSv3)
  field(:cvssVersion)
  field(:cwe, type: :list)
  field(:details, as: GoogleApi.ContainerAnalysis.V1beta1.Model.Detail, type: :list)
  field(:severity)
  field(:sourceUpdateTime, as: DateTime)
  field(:windowsDetails, as: GoogleApi.ContainerAnalysis.V1beta1.Model.WindowsDetail, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.ContainerAnalysis.V1beta1.Model.Vulnerability do
  def decode(value, options) do
    GoogleApi.ContainerAnalysis.V1beta1.Model.Vulnerability.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ContainerAnalysis.V1beta1.Model.Vulnerability do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
